package com.ytd.common.bean;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 定时开关机配置类
 *
 * @author gaoguanchao
 * @since 2023/11/2 0002
 */
public class TimerInfo implements Serializable {

    /**
     * createId : 1650336483787280384
     * createTime : 2023-11-01 11:07:48
     * dayOfWeeks : ["1","2","3","4","5","6","7"]
     * deleted : 0
     * enabled : 1
     * id : 1719551787083632640
     * mode : 0
     * time : 17:10
     * type : 1
     * updateId : 1650336483787280384
     * updateTime : 2023-11-01 15:01:19.057
     */

    public String createId;
    public String createTime;
    public int deleted;
    public int enabled;
    public String id;
    public int mode;
    public int intelligenceValid;
    public String time;
    public int type;
    public String updateId;
    public String updateTime;
    public List<String> dayOfWeeks;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TimerInfo timerInfo = (TimerInfo) o;
        return Objects.equals(id, timerInfo.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        if (mode == 0) {
            return "{" + (type == 0 ? "开机时间：" : "关机时间：") + time + "," + dayOfWeeks + "}";
        } else {
            return "{" + (type == 0 ? "开机时间：" : "关机时间：") + time + "," +
                (intelligenceValid == 3 ? "所有日期" : (intelligenceValid == 1 ? "工作日生效" : "节假日生效")) + "}";
        }
    }
}
